import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: () => import('../views/Layout.vue'),
      children: [
        {
          path: '',
          name: 'home',
          meta: { name: '首页', ifShow: true },
          component: () => import('../views/HomeView.vue')
        },
        {
          path: '/cake',
          name: 'cake',
          meta: { name: '蛋糕', ifShow: true },
          component: () => import('../views/CakeView.vue')
        },
        {
          path: '/cart',
          name: 'cart',
          meta: { name: '购物车', ifShow: false },
          component: () => import('../views/CartView.vue')
        },
        {
          path: '/buy',
          name: 'buy',
          meta: { name: '购物车', ifShow: false },
          component: () => import('../views/OrderView.vue')
        },
        {
          path: '/logistics',
          name: 'logistics',
          meta: { name: '物流', ifShow: false },
          component: () => import('../views/LogisticsView.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    }

  ],
})

export default router
